if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_CongNo_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_CongNo_Update]
GO

create PROC [dbo].[sp_CongNo_Update]
	@ID						INT,
	@Ma_khach_hang			int,
	@Ma_loai_cong_no		INT,
	@Thanh_toan				Float,
	@Ma_ngoai_te			float,
	@Ty_gia					float,
	@Thanh_tien				float,		
	@Ghi_chu				NVARCHAR(100)

AS
BEGIN
	DECLARE @Ngay_cap_nhat_cuoi datetime
	SET @Ngay_cap_nhat_cuoi = getdate()
	UPDATE CongNo
		SET				
					Ma_khach_hang=@Ma_khach_hang,	
					Ma_loai_cong_no=@Ma_loai_cong_no,
					Thanh_toan=@Thanh_toan,
					Ma_ngoai_te=@Ma_ngoai_te,
					Ty_gia=@Ty_gia,
					Thanh_tien=@Thanh_tien,
					Ghi_chu = @Ghi_chu,
					Ngay_cap_nhat_cuoi = @Ngay_cap_nhat_cuoi
	WHERE 				
					id = @ID
END
